#include "../include/steiner.h"
#include <stdlib.h>

void freeGraph(graph * ref) {
  int i,j;

  for (i=0;i<(ref->TotalNodes);i++) {
    free((ref->adjacency)[i]);
  };
  free(ref->adjacency);

  free(ref);

  return (void) 0;
};

void initializeGraph(graph * ref, int size) {

  int i,j;
  
  ref->TotalNodes = size;
  
  ref->adjacency = (int **) malloc(sizeof(int *)*(ref->TotalNodes));

  for (i=0;i<(ref->TotalNodes);i++) {
    (ref->adjacency)[i] = (int *) malloc(sizeof(int)*(ref->TotalNodes));
    for (j=0;j<(ref->TotalNodes);j++) {
      (ref->adjacency)[i][j] = NO_EDGE;
    };
  };

  return (void) 0;

};
